<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/include/common/gridbackhead.jsp"%>
<%!
private class PageAction extends BaseAction{
	//加載頁面默認數據
	protected boolean onLoadDefault() throws Exception{
		return onSearch();
	}
	
	// 取出查询結果
	protected void onSearchRetrieveResult() throws Exception{
	    String sql = onSearchGetSql();	
		if(ret.isError())return;
		//設置返回結果
		ResultSet rs = utils.executePagingQuery2("grid1","info",sql,20);
		ret.SetSearchResult(rs);
	}
	
	//取出查詢語句
	protected String onSearchGetSql() throws Exception{
		StringBuilderEx whr =  new StringBuilderEx("1=1");
		if(!form.isNullOrEmpty("codeName")) {//廠商代號
			whr.Append(" and codeName like '%1$s'","%"+form.gpsv("codeName")+"%");
		}
		
		if(!form.isNullOrEmpty("shortName")) {//簡稱
			whr.Append(" and shortName like '%1$s' ","%"+form.gpsv("shortName")+"%");
		}
		
		if(!form.isNullOrEmpty("fullName")) {//全稱
			whr.Append(" and chfullName like '%1$s' ","%"+form.gpsv("fullName")+"%");
		}
		
		if(!form.isNullOrEmpty("sys004aSn")) {//廠商sn
			whr.Append(" and sys004aSn ='%1$s' ",form.gpsv("sys004aSn"));
		}
		
		if(!form.isNullOrEmpty("vdr")) {//廠商代號
			whr.Append(" and codeName like '%1$s' ",form.gpsv("vdr"));
		}
		
		return StringHelper.Format("select tsn ,codeName,shortName,chfullName from sys..sys004 where %1$s order by codeName",whr.toString());
		
	}
	
	//处理自定義操作
	protected boolean onCustomAction(String action) throws Exception{
		return super.onCustomAction(action);
	}
}
%>
<%@include file="/include/common/gridbackend.jsp"%>